package org.xx.armory.http;

import org.xx.armory.commons.MapBuilder;

import java.util.Collections;
import java.util.Map;

/**
 * {@literal MIME}类型对照表。
 */
@SuppressWarnings("SpellCheckingInspection")
public final class MIMETypes {
    /**
     * 通过扩展名查询{@literal MIME类型}的对照表。
     */
    public static final Map<String, String> EXT_MIME_MAP = Collections
            .unmodifiableMap(new MapBuilder<String, String>()
                                     .put(".txt", "text/plain")
                                     .put(".text", "text/plain")
                                     .put(".xml", "application/xml")

                                     .put(".csv", "text/comma-separated-values")

                                     .put(".css", "text/css")
                                     .put(".js", "application/javascript")
                                     .put(".html", "text/html")
                                     .put(".htm", "text/html")

                                     .put(".bmp", "image/bmp")
                                     .put(".gif", "image/gif")
                                     .put(".png", "image/png")
                                     .put(".jpg", "image/jpeg")
                                     .put(".jpeg", "image/jpeg")
                                     .put(".ico", "image/x-icon")
                                     .put(".icon", "image/x-icon")

                                     .put(".swf", "application/x-shockwave-flash")
                                     .put(".pdf", "application/pdf")
                                     .put(".zip", "application/zip")
                                     .put(".bz", "application/x-bzip")
                                     .put(".bz2", "application/x-bzip2")
                                     .put(".tar", "application/x-tar")
                                     .put(".rar", "application/x-rar-compressed")
                                     .put(".xls", "application/vnd.ms-excel")
                                     .put(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
                                     .put(".doc", "application/msword")
                                     .put(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
                                     .put(".ppt", "application/vnd.ms-powerpoint")
                                     .put(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")

                                     .put(".dat", "application/octet-stream")
                                     .put(".bin", "application/octet-stream")

                                     .buildHashMap()
            );

    private MIMETypes() {
        throw new UnsupportedOperationException();
    }
}
